import { getCreditBill, postCreditBill, getCreditBillByID, deleteCreditBillByID,  } from "@/api/ApiRequest" 

export default {
  data() {
    return {
      /// relateList

      /// table
      columns: [
        {
          title: '记录id',//记录id
          dataIndex: 'id',
          key: 'id',
          sort: 'up',
          align: 'center',
          width: 100,
          showTime: false,
        },
        {
          title: '名称',//名称
          dataIndex: 'authCode',
          key: 'authCode',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '卡片顺序',//卡片顺序
          dataIndex: 'cardIndex',
          key: 'cardIndex',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '卡片名称',//卡片名称
          dataIndex: 'cardName',
          key: 'cardName',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '卡片编号',//卡片编号
          dataIndex: 'cardNo',
          key: 'cardNo',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '名称',//名称
          dataIndex: 'cardNolast4',
          key: 'cardNolast4',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '消费金额',//消费金额
          dataIndex: 'consumeAmt',
          key: 'consumeAmt',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '名称',//名称
          dataIndex: 'consumeCurType',
          key: 'consumeCurType',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '代码',//代码
          dataIndex: 'curType',
          key: 'curType',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '涨跌额',//涨跌额
          dataIndex: 'effectDate',
          key: 'effectDate',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '涨跌幅',//涨跌幅
          dataIndex: 'icon',
          key: 'icon',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '今年以来涨跌幅',//今年以来涨跌幅
          dataIndex: 'postDate',
          key: 'postDate',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '成交量',//成交量
          dataIndex: 'recordStatus',
          key: 'recordStatus',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '成交额',//成交额
          dataIndex: 'refNo',
          key: 'refNo',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '换手率',//换手率
          dataIndex: 'tranType',
          key: 'tranType',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '滚动市盈率',//滚动市盈率
          dataIndex: 'tranTypeDesc',
          key: 'tranTypeDesc',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '股息收益率',//股息收益率
          dataIndex: 'transLog',
          key: 'transLog',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '市值',//市值
          dataIndex: 'txnAmount',
          key: 'txnAmount',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '市值',//市值
          dataIndex: 'txnCode',
          key: 'txnCode',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '市值',//市值
          dataIndex: 'url',
          key: 'url',
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          title: '创建于',//创建于
          dataIndex: 'createAt',
          key: 'createAt',
          sort: 'up',
          align: 'center',
          width: 100,
          showTime: true,
        },
        {
          title: '更新于',//更新于
          dataIndex: 'updateAt',
          key: 'updateAt',
          sort: 'up',
          align: 'center',
          width: 100,
          showTime: true,
        },
        {
          title: '删除于',//删除于
          dataIndex: 'deleteAt',
          key: 'deleteAt',
          sort: 'up',
          align: 'center',
          width: 100,
          showTime: true,
        },

        {
          title: '操作',
          scopedSlots: {
            customRender: 'action',
          },
        },
      ],

      /// 搜索内容
      searchList: [
        {
          name: 'authCode', //名称 
          title: '名称',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'authCode',
            {
              rules: [
                { required: 0, message: '名称 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'cardIndex', //卡片顺序 
          title: '卡片顺序',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'cardIndex',
            {
              rules: [
                { required: 0, message: '卡片顺序 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'cardName', //卡片名称 
          title: '卡片名称',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'cardName',
            {
              rules: [
                { required: 0, message: '卡片名称 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'cardNo', //卡片编号 
          title: '卡片编号',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'cardNo',
            {
              rules: [
                { required: 0, message: '卡片编号 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'cardNolast4', //名称 
          title: '名称',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'cardNolast4',
            {
              rules: [
                { required: 0, message: '名称 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'consumeAmt', //消费金额 
          title: '消费金额',
          type: 'number', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'consumeAmt',
            {
              rules: [
                { required: 0, message: '消费金额 为必填项' },
              ],
            },
          ],
          precision: 0,
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'consumeCurType', //名称 
          title: '名称',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'consumeCurType',
            {
              rules: [
                { required: 0, message: '名称 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'curType', //代码 
          title: '代码',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'curType',
            {
              rules: [
                { required: 0, message: '代码 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'effectDate', //涨跌额 
          title: '涨跌额',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'effectDate',
            {
              rules: [
                { required: 0, message: '涨跌额 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'icon', //涨跌幅 
          title: '涨跌幅',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'icon',
            {
              rules: [
                { required: 0, message: '涨跌幅 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'postDate', //今年以来涨跌幅 
          title: '今年以来涨跌幅',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'postDate',
            {
              rules: [
                { required: 0, message: '今年以来涨跌幅 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'recordStatus', //成交量 
          title: '成交量',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'recordStatus',
            {
              rules: [
                { required: 0, message: '成交量 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'refNo', //成交额 
          title: '成交额',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'refNo',
            {
              rules: [
                { required: 0, message: '成交额 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'tranType', //换手率 
          title: '换手率',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'tranType',
            {
              rules: [
                { required: 0, message: '换手率 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'tranTypeDesc', //滚动市盈率 
          title: '滚动市盈率',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'tranTypeDesc',
            {
              rules: [
                { required: 0, message: '滚动市盈率 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'transLog', //股息收益率 
          title: '股息收益率',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'transLog',
            {
              rules: [
                { required: 0, message: '股息收益率 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'txnAmount', //市值 
          title: '市值',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'txnAmount',
            {
              rules: [
                { required: 0, message: '市值 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'txnCode', //市值 
          title: '市值',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'txnCode',
            {
              rules: [
                { required: 0, message: '市值 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'url', //市值 
          title: '市值',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'url',
            {
              rules: [
                { required: 0, message: '市值 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'createAt', //创建于 
          title: '创建于',
          type: 'date', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'createAt',
            {
              rules: [
                { required: 0, message: '创建于 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'center',
          width: 100,
          showTime: true,
        },
        {
          name: 'updateAt', //更新于 
          title: '更新于',
          type: 'date', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'updateAt',
            {
              rules: [
                { required: 0, message: '更新于 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'center',
          width: 100,
          showTime: true,
        },
      ],

      /// 表单信息列表
      formList: [
        {
          name: 'authCode', //名称 
          title: '名称',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'authCode',
            {
              rules: [
                { required: 0, message: '名称 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'cardIndex', //卡片顺序 
          title: '卡片顺序',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'cardIndex',
            {
              rules: [
                { required: 0, message: '卡片顺序 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'cardName', //卡片名称 
          title: '卡片名称',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'cardName',
            {
              rules: [
                { required: 0, message: '卡片名称 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'cardNo', //卡片编号 
          title: '卡片编号',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'cardNo',
            {
              rules: [
                { required: 0, message: '卡片编号 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'cardNolast4', //名称 
          title: '名称',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'cardNolast4',
            {
              rules: [
                { required: 0, message: '名称 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'consumeAmt', //消费金额 
          title: '消费金额',
          type: 'number', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'consumeAmt',
            {
              rules: [
                { required: 0, message: '消费金额 为必填项' },
              ],
            },
          ],
          precision: 0,
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'consumeCurType', //名称 
          title: '名称',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'consumeCurType',
            {
              rules: [
                { required: 0, message: '名称 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'curType', //代码 
          title: '代码',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'curType',
            {
              rules: [
                { required: 0, message: '代码 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'effectDate', //涨跌额 
          title: '涨跌额',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'effectDate',
            {
              rules: [
                { required: 0, message: '涨跌额 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'icon', //涨跌幅 
          title: '涨跌幅',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'icon',
            {
              rules: [
                { required: 0, message: '涨跌幅 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'postDate', //今年以来涨跌幅 
          title: '今年以来涨跌幅',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'postDate',
            {
              rules: [
                { required: 0, message: '今年以来涨跌幅 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'recordStatus', //成交量 
          title: '成交量',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'recordStatus',
            {
              rules: [
                { required: 0, message: '成交量 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'refNo', //成交额 
          title: '成交额',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'refNo',
            {
              rules: [
                { required: 0, message: '成交额 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'tranType', //换手率 
          title: '换手率',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'tranType',
            {
              rules: [
                { required: 0, message: '换手率 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'tranTypeDesc', //滚动市盈率 
          title: '滚动市盈率',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'tranTypeDesc',
            {
              rules: [
                { required: 0, message: '滚动市盈率 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'transLog', //股息收益率 
          title: '股息收益率',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'transLog',
            {
              rules: [
                { required: 0, message: '股息收益率 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'txnAmount', //市值 
          title: '市值',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'txnAmount',
            {
              rules: [
                { required: 0, message: '市值 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'txnCode', //市值 
          title: '市值',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'txnCode',
            {
              rules: [
                { required: 0, message: '市值 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
        {
          name: 'url', //市值 
          title: '市值',
          type: 'text', // text, number, numberRange, select, date, datetime, dateRange
          decorator: [
            'url',
            {
              rules: [
                { required: 0, message: '市值 为必填项' },
              ],
            },
          ],
          sort: 'up',
          align: 'left',
          width: 100,
          showTime: false,
        },
      ],

      listRequest: getCreditBill,
      addRequest: postCreditBill,
      editRequest: postCreditBill,
      detailRequest: getCreditBillByID,
      deleteRequest: deleteCreditBillByID,
    };
  },
  methods: {
    async init() {
    },
    //===================== 处理请求参数
    // 列表请求参数
    async handleListRequestParams(params) {
      this.log("handleListRequestParams", params);
      return params;
    },
    // 新增或者修改保存参数
    async handleSaveRequestParams(params) {
      this.log("handleSaveRequestParams", params);
      return params;
    },
    // 请求详情接口参数
    async handleDetailRequestParams(params) {
      this.log("handleDetailRequestParams", params);
      return params;
    },
    // 删除列表参数
    async handleDeleteRequestParams(params) {
      this.log("handleDeleteRequestParams", params);
      return params;
    },
    // 处理列表返回数据
    // async handleListData(data) {
    //  this.log("handleListData", data);
    //  return data;
    // },
    //===================== search
    // 准备搜索回调
    onWillSearch(params) {
      this.log("onWillSearch", params);
    },
    // 准备搜索回调
    onWillSearchReqeust(params, pagination) {
      this.log("onWillSearchReqeust", params, pagination);
    },
    // 完成搜索回调
    onDidSearch() {
      this.log("onDidSearch");
    },

    //===================== 列表
    // 准备调用列表接口
    onWillGetList() {
      this.log("onWillGetList");
    },
    // 即将开始请求列表接口
    onWillGetListRequest(params) {
      this.log("onWillGetListRequest", params);
    },
    // 列表请求成功
    onGetListSuccess(data) {
      this.log("onGetListSuccess", data);
    },
    // 列表请求失败
    onGetListError(error) {
      this.log("onGetListError", error);
    },

    //===================== 新增
    // 准备新增
    onWillAdd() {
      this.log("onWillAdd");
    },
    // 新增成功
    onAddSuccess(data) {
      this.log("onAddSuccess", data);
    },
    // 新增失败
    onAddError(error) {
      this.log("onAddError", error);
    },

    //===================== 更新
    // 准备更新
    onWillEdit(data) {
      this.log("onWillEdit", data);
    },
    // 更新成功
    onEditSuccess(data) {
      this.log("onEditSuccess", data);
    },
    // 更新失败
    onEditError(error) {
      this.log("onEditError", error);
    },

    // 准备调用新增或者修改接口
    onWillSaveReqeust(params) {
      this.log("onWillSaveReqeust", params);
    },

    //===================== 删除
    // 准备删除
    onWillDelete(id) {
      this.log("onWillDelete", id);
    },
    // 即将开始请求删除接口
    onWillDeleteReqeust(params) {
      this.log("onWillDeleteReqeust", params);
    },
    // 删除成功
    onDeleteSuccess(data) {
      this.log("onDeleteSuccess", data);
    },
    // 删除失败
    onDeleteError(error) {
      this.log("onDeleteError", error);
    },

    //===================== 其他
    // form表单前缀内容点击
    onFormPrefixClick(error) {
      this.log("onFormPrefixClick", error);
    },
    // form表单后缀内容点击
    onFormSuffixClick(error) {
      this.log("onFormSuffixClick", error);
    },
    log(title, msg) {
      console.log(`[CreditBill->${title}]`, msg ?? "");
    }
  },
};
